﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:control="clr-namespace:ViewOnCore.Helper.WPF"
    x:Class="ViewOnCore.Helper.WPF.ColorSelector"
    Width="110" Height="90" Background="{DynamicResource VOColor16}" BorderBrush="{DynamicResource VOColor13}" BorderThickness="2,2,2,2">

<UserControl.Resources>
		<!-- Slider Template : Position -->
		<Style x:Key="PositionSliderButtonStyle" TargetType="{x:Type RepeatButton}">
			<Setter Property="SnapsToDevicePixels" Value="true"/>
			<Setter Property="OverridesDefaultStyle" Value="true"/>
			<Setter Property="IsTabStop" Value="false"/>
			<Setter Property="Focusable" Value="false"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type RepeatButton}">
						<Border Background="Transparent" />
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="PositionSliderThumbStyle" TargetType="{x:Type Thumb}">
			<Setter Property="SnapsToDevicePixels" Value="true"/>
			<Setter Property="OverridesDefaultStyle" Value="true"/>
			<Setter Property="Focusable" Value="false"/>
			<Setter Property="Height" Value="14"/>
			<Setter Property="Width" Value="14"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Thumb}">
						<Border
										x:Name="Ellipse"
										CornerRadius="0,0,0,0"
										Background="#FF434343"
										BorderBrush="#FFF0F0F0"
										BorderThickness="1" RenderTransformOrigin="0.5,0.5" Width="8" Height="8" >
							<Border.RenderTransform>
								<TransformGroup>
									<ScaleTransform ScaleX="1" ScaleY="1"/>
									<SkewTransform AngleX="0" AngleY="0"/>
									<RotateTransform Angle="45"/>
									<TranslateTransform X="0" Y="0"/>
								</TransformGroup>
							</Border.RenderTransform>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter TargetName="Ellipse" Property="Background" Value="#FFAAAAAA"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

	<ControlTemplate x:Key="BrigthnessVerticalSlider" TargetType="{x:Type Slider}">
		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition Width="Auto" MinWidth="{TemplateBinding MinWidth}"/>
				<ColumnDefinition Width="Auto"/>
			</Grid.ColumnDefinitions>
			<TickBar
				x:Name="TopTick"
				SnapsToDevicePixels="True"
				Placement="Top"
				Fill="Transparent"
				Height="4"
				Visibility="Collapsed" />
			<Border
				x:Name="TrackBackground"
				Margin="0"
				CornerRadius="2"
				Width="2"
				Grid.Column="1"
				Background="#FF333333"
				BorderBrush="#FF333333"
				BorderThickness="1" />
			<Track Grid.Column="1" x:Name="PART_Track">
				<Track.DecreaseRepeatButton>
					<RepeatButton
						Style="{StaticResource PositionSliderButtonStyle}"
						Command="Slider.DecreaseLarge" />
				</Track.DecreaseRepeatButton>
				<Track.IncreaseRepeatButton>
					<RepeatButton
						Style="{StaticResource PositionSliderButtonStyle}"
						Command="Slider.IncreaseLarge" />
				</Track.IncreaseRepeatButton>
				<Track.Thumb>
					<Thumb Style="{StaticResource PositionSliderThumbStyle}" />
				</Track.Thumb>
			</Track>
			<TickBar
				x:Name="BottomTick"
				SnapsToDevicePixels="True"
				Grid.Column="2"
				Fill="{TemplateBinding Foreground}"
				Placement="Bottom"
				Height="4"
				Visibility="Collapsed" />
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="TickPlacement" Value="TopLeft">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="BottomRight">
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="Both">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

	<Style x:Key="BrigthnessSliderTemplate" TargetType="{x:Type Slider}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Style.Triggers>
			<Trigger Property="Orientation" Value="Vertical">
				<Setter Property="MinWidth" Value="21" />
				<Setter Property="MinHeight" Value="30" />
				<Setter Property="Template" Value="{StaticResource BrigthnessVerticalSlider}" />
			</Trigger>
		</Style.Triggers>
	</Style>

	</UserControl.Resources>	
	
	
	
	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition/>
			<ColumnDefinition Width="25"/>
		</Grid.ColumnDefinitions>
		<Slider Grid.Column="1" Style="{StaticResource BrigthnessSliderTemplate}" Orientation="Vertical" Margin="4,5,0,5" x:Name="sliBrightness" HorizontalAlignment="Center" Value="90" Maximum="100" LargeChange="10"/>
		<control:ColorComb RenderTransformOrigin="0.5,0.5" x:Name="colPicker">
			<control:ColorComb.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="0.3" ScaleY="0.3"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="0"/>
					<TranslateTransform X="-28" Y="-27"/>
				</TransformGroup>
			</control:ColorComb.RenderTransform>
		</control:ColorComb>
	</Grid>
</UserControl>
